#!/bin/bash

os() {
  source /etc/os-release
  echo  $PRETTY_NAME | awk '{print $1;}' 
}

wm() {
  wm=$XDG_CURRENT_DESKTOP
  [ "$wm" ] || wm=$DESKTOP_SESSION

  ## WM/DE
  [ ! "$wm" ] &&
    # loop over all processes and check the binary name
    for i in /proc/*/comm; do
      read -r c <"$i"
      case $c in
      *bar*) ;;
      awesome | xmonad* | qtile | sway | i3 | [bfo]*box | *wm*)
        wm=${c%%-*}
        break
        ;;
      esac
    done

  echo $wm
}

shell() {
  basename $SHELL
}

"$@"
